package org.apache.harmony.javax.security.auth.callback;

import java.io.Serializable;

public class ConfirmationCallback
  implements Callback, Serializable
{
  public static final int CANCEL = 2;
  public static final int ERROR = 2;
  public static final int INFORMATION = 0;
  public static final int NO = 1;
  public static final int OK = 3;
  public static final int OK_CANCEL_OPTION = 2;
  public static final int UNSPECIFIED_OPTION = -1;
  public static final int WARNING = 1;
  public static final int YES = 0;
  public static final int YES_NO_CANCEL_OPTION = 1;
  public static final int YES_NO_OPTION = 0;
  private static final long serialVersionUID = 291904808L;
  private int defaultOption;
  private int messageType;
  private int optionType = -1;
  private String[] options;
  private String prompt;
  private int selection;

  public ConfirmationCallback(int paramInt1, int paramInt2, int paramInt3)
  {
    if ((paramInt1 > 2) || (paramInt1 < 0))
      throw new IllegalArgumentException("auth.16");
    switch (paramInt2)
    {
    default:
      throw new IllegalArgumentException("auth.18");
    case 0:
      if ((paramInt3 == 0) || (paramInt3 == 1))
        break label129;
      throw new IllegalArgumentException("auth.17");
    case 1:
      if ((paramInt3 == 0) || (paramInt3 == 1) || (paramInt3 == 2))
        break label129;
      throw new IllegalArgumentException("auth.17");
    case 2:
    }
    if ((paramInt3 != 3) && (paramInt3 != 2))
      throw new IllegalArgumentException("auth.17");
    label129: this.messageType = paramInt1;
    this.optionType = paramInt2;
    this.defaultOption = paramInt3;
  }

  public ConfirmationCallback(int paramInt1, String[] paramArrayOfString, int paramInt2)
  {
    if ((paramInt1 > 2) || (paramInt1 < 0))
      throw new IllegalArgumentException("auth.16");
    if ((paramArrayOfString == null) || (paramArrayOfString.length == 0))
      throw new IllegalArgumentException("auth.1A");
    int i = 0;
    while (true)
    {
      if (i >= paramArrayOfString.length)
      {
        if ((paramInt2 >= 0) && (paramInt2 < paramArrayOfString.length))
          break;
        throw new IllegalArgumentException("auth.17");
      }
      if ((paramArrayOfString[i] == null) || (paramArrayOfString[i].length() == 0))
        throw new IllegalArgumentException("auth.1A");
      ++i;
    }
    this.options = paramArrayOfString;
    this.defaultOption = paramInt2;
    this.messageType = paramInt1;
  }

  public ConfirmationCallback(String paramString, int paramInt1, int paramInt2, int paramInt3)
  {
    if ((paramString == null) || (paramString.length() == 0))
      throw new IllegalArgumentException("auth.14");
    if ((paramInt1 > 2) || (paramInt1 < 0))
      throw new IllegalArgumentException("auth.16");
    switch (paramInt2)
    {
    default:
      throw new IllegalArgumentException("auth.18");
    case 0:
      if ((paramInt3 == 0) || (paramInt3 == 1))
        break label156;
      throw new IllegalArgumentException("auth.17");
    case 1:
      if ((paramInt3 == 0) || (paramInt3 == 1) || (paramInt3 == 2))
        break label156;
      throw new IllegalArgumentException("auth.17");
    case 2:
    }
    if ((paramInt3 != 3) && (paramInt3 != 2))
      throw new IllegalArgumentException("auth.17");
    label156: this.prompt = paramString;
    this.messageType = paramInt1;
    this.optionType = paramInt2;
    this.defaultOption = paramInt3;
  }

  public ConfirmationCallback(String paramString, int paramInt1, String[] paramArrayOfString, int paramInt2)
  {
    if ((paramString == null) || (paramString.length() == 0))
      throw new IllegalArgumentException("auth.14");
    if ((paramInt1 > 2) || (paramInt1 < 0))
      throw new IllegalArgumentException("auth.16");
    if ((paramArrayOfString == null) || (paramArrayOfString.length == 0))
      throw new IllegalArgumentException("auth.1A");
    int i = 0;
    while (true)
    {
      if (i >= paramArrayOfString.length)
      {
        if ((paramInt2 >= 0) && (paramInt2 < paramArrayOfString.length))
          break;
        throw new IllegalArgumentException("auth.17");
      }
      if ((paramArrayOfString[i] == null) || (paramArrayOfString[i].length() == 0))
        throw new IllegalArgumentException("auth.1A");
      ++i;
    }
    this.options = paramArrayOfString;
    this.defaultOption = paramInt2;
    this.messageType = paramInt1;
    this.prompt = paramString;
  }

  public int getDefaultOption()
  {
    return this.defaultOption;
  }

  public int getMessageType()
  {
    return this.messageType;
  }

  public int getOptionType()
  {
    return this.optionType;
  }

  public String[] getOptions()
  {
    return this.options;
  }

  public String getPrompt()
  {
    return this.prompt;
  }

  public int getSelectedIndex()
  {
    return this.selection;
  }

  public void setSelectedIndex(int paramInt)
  {
    if (this.options != null)
    {
      if ((paramInt >= 0) && (paramInt <= this.options.length))
      {
        this.selection = paramInt;
        return;
      }
      throw new ArrayIndexOutOfBoundsException("auth.1B");
    }
    switch (this.optionType)
    {
    default:
    case 0:
    case 1:
    case 2:
    }
    do
    {
      do
      {
        do
          while (true)
            this.selection = paramInt;
        while ((paramInt == 0) || (paramInt == 1));
        throw new IllegalArgumentException("auth.19");
      }
      while ((paramInt == 0) || (paramInt == 1) || (paramInt == 2));
      throw new IllegalArgumentException("auth.19");
    }
    while ((paramInt == 3) || (paramInt == 2));
    throw new IllegalArgumentException("auth.19");
  }
}